package com.snail.manager.user.controller;

import com.snail.manager.user.entity.Result;
import com.snail.manager.user.entity.User;
import com.snail.manager.user.service.UserService;
import com.snail.manager.user.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/userInfo")
public class UserController {
    @Autowired
    private UserService userService;
    //用户列表页面跳转

    @RequestMapping(value = "/userList", method = RequestMethod.GET)
    public String userList(){
        return "UserManager/userList";
    }

    @ResponseBody
    @RequestMapping(value = "/userList",method = RequestMethod.POST)
    public Result<User> getUserLists(){
        System.out.println("+++++++++++++++++++before");
       List<User> list =   userService.getUserList();
        System.out.printf("----------------------after");
        Result<User> result = new Result<User>();
        result.setDatas(list);
        return result;
    }

}
